package com.nipun.neural.objects.neurons;

import com.nipun.graph.objects.VertexImpl;
import com.nipun.neural.objects.Neuron;

public abstract class BaseNeuronImpl extends VertexImpl implements Neuron {
	
	protected double activation;
	
	protected double ACT_CONST;
	
	protected double bias;
	
	protected double delta;
	
	public BaseNeuronImpl(String label){
		super(label);
		ACT_CONST = 2;
		bias = 0;
	}
	

	/* (non-Javadoc)
	 * 
	 * the firing method for neuron.
	 * for firing :
	 * 1. collect inputs
	 * 2. compute effectve input
	 * 3. set activation equal to activation function of effective input
	 * ----only (3) is done here rest is done in networkimpl class/ runner class
	 * 
	 * @see com.nipun.neural.objects.Neuron#fire()
	 */
	
	public abstract void fire(double input);

	
	public void setActivation(double act) {
		activation = act;
	}
	
	public abstract double actFunction(double input);

	
	public double getBias() {
		return bias;
	}

	
	public void setBias(double bias) {
		this.bias = bias;
	}

	
	public double getDelta() {
		return delta;
	}

	
	public void setDelta(double delta) {
		this.delta = delta;
	}

	
	public double getActivation() {
		return activation;
	}
	
	abstract public double getDerivative();

}
